#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

#define NOISY_TEST 1

void checkIsGameOver_all_provinces(struct gameState *post) {
  int test;
  post -> supplyCount[province] = 0;
  test = isGameOver(post);
  assert(test == 1);
}

void checkIsGameOver_all_but_one_province(struct gameState *post) {
  int test;
  post -> supplyCount[province] = 1;
  test = isGameOver(post);
  assert(test == 0);
}

void checkIsGameOver_two_cards(struct gameState *post) {
  int test;
  post -> supplyCount[adventurer] = 0;
  post -> supplyCount[council_room] = 0;
  post -> supplyCount[smithy] = 1;
  test = isGameOver(post);
  assert(test == 0);
}

void checkIsGameOver_three_cards(struct gameState *post) {
  int test;
  post -> supplyCount[adventurer] = 0;
  post -> supplyCount[council_room] = 0;
  post -> supplyCount[smithy] = 0;
  test = isGameOver(post);
  assert(test == 1);
}

int run_tests5() {
  int k[10] = {adventurer, council_room, feast, gardens, mine,
	       remodel, smithy, village, baron, great_hall};
  struct gameState G;
  initializeGame(2, k, 1, &G);
  printf ("FIXED TESTING isGameOver.\n");
  printf ("Testing isGame over, all provinces bought.\n");
  checkIsGameOver_all_provinces(&G);
  printf ("Testing isGame over, all but one province bought.\n");
  checkIsGameOver_all_but_one_province(&G);
  printf ("Testing isGame over, two card stacks bought.\n");
  checkIsGameOver_two_cards(&G);
  printf ("Testing isGame over, three card stacks bought.\n");
  checkIsGameOver_three_cards(&G);

  printf ("ALL TESTS OK\n");
  return 0;
}
